| Conditions | 1 |
| Paths | 1 |
| Total Lines | 122 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 1 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | module.exports = function (grunt) { |
||
| 2 | require('load-grunt-tasks')(grunt); |
||
| 3 | grunt.initConfig({ |
||
| 4 | clean: { |
||
| 5 | assets: ['web/assets/dist'], |
||
| 6 | }, |
||
| 7 | copy: { |
||
| 8 | fonts: { |
||
| 9 | files: [ |
||
| 10 | { |
||
| 11 | expand: true, |
||
| 12 | cwd: 'node_modules/OswaldFont/fonts/ttf', |
||
| 13 | dest: 'web/assets/dist/fonts', |
||
| 14 | src: ['Oswald-Regular.ttf', 'Oswald-Bold.ttf'] |
||
| 15 | }, |
||
| 16 | { |
||
| 17 | expand: true, |
||
| 18 | cwd: 'node_modules/bootstrap/fonts', |
||
| 19 | dest: 'web/assets/dist/fonts', |
||
| 20 | src: ['**'] |
||
| 21 | }], |
||
| 22 | }, |
||
| 23 | image: { |
||
| 24 | files: [ |
||
| 25 | { |
||
| 26 | expand: true, |
||
| 27 | cwd: 'web/assets/image', |
||
| 28 | dest: 'web/assets/dist/image', |
||
| 29 | src: ['**'] |
||
| 30 | }, |
||
| 31 | { |
||
| 32 | expand: true, |
||
| 33 | cwd: 'node_modules/chosen-js/', |
||
| 34 | dest: 'web/assets/dist/css', |
||
| 35 | src: ['chosen-sprite.png'] |
||
| 36 | } |
||
| 37 | ] |
||
| 38 | }, |
||
| 39 | }, |
||
| 40 | cssmin: { |
||
| 41 | options: { |
||
| 42 | root: 'web/assets/dist/css/', |
||
| 43 | report: 'gzip', |
||
| 44 | keepSpecialComments: 0, |
||
| 45 | sourceMap: true, |
||
| 46 | outputSourceFiles: true |
||
| 47 | }, |
||
| 48 | target: { |
||
| 49 | files: { |
||
| 50 | 'web/assets/dist/css/vendors.min.css': [ |
||
| 51 | 'node_modules/bootstrap/dist/css/bootstrap.min.css', |
||
| 52 | 'node_modules/chosen-js/chosen.min.css', |
||
| 53 | 'node_modules/slabText/css/slabtext.css', |
||
| 54 | 'node_modules/videosjs-assets/dist/video-js.min.css', |
||
| 55 | 'node_modules/videojs-qualityselector/dist/videojs-qualityselector.css' |
||
| 56 | ], |
||
| 57 | 'web/assets/dist/css/app.min.css': [ |
||
| 58 | 'web/assets/css/jumbotron-narrow.css', |
||
| 59 | 'web/assets/css/custom.css', |
||
| 60 | ], |
||
| 61 | } |
||
| 62 | } |
||
| 63 | }, |
||
| 64 | uglify: { |
||
| 65 | options: { |
||
| 66 | mangle: false, |
||
| 67 | sourceMap: true, |
||
| 68 | // sourceMapIncludeSources: true, |
||
| 69 | }, |
||
| 70 | app: { |
||
| 71 | files: { |
||
| 72 | 'web/assets/dist/js/app.min.js': [ |
||
| 73 | 'web/assets/js/*js', |
||
| 74 | ] |
||
| 75 | } |
||
| 76 | }, |
||
| 77 | translation: { |
||
| 78 | files: [{ |
||
| 79 | expand: true, |
||
| 80 | cwd: 'web/assets/js/translations/', |
||
| 81 | src: ['*.js', '!*.min.js'], |
||
| 82 | dest: 'web/assets/dist/js/translations', |
||
| 83 | ext: '.min.js' |
||
| 84 | }] |
||
| 85 | } |
||
| 86 | }, |
||
| 87 | concat: { |
||
| 88 | options: { |
||
| 89 | separator: grunt.util.linefeed + grunt.util.linefeed, |
||
| 90 | }, |
||
| 91 | vendors: { |
||
| 92 | src: [ |
||
| 93 | 'node_modules/jquery/dist/jquery.min.js', |
||
| 94 | 'node_modules/bootstrap/dist/js/bootstrap.min.js', |
||
| 95 | 'node_modules/chosen-js/chosen.jquery.min.js', |
||
| 96 | 'node_modules/videosjs-assets/dist/video.min.js', |
||
| 97 | 'node_modules/slabText/js/jquery.slabtext.js', |
||
| 98 | 'vendor/willdurand/js-translation-bundle/Resources/public/js/translator.min.js', |
||
| 99 | 'node_modules/videojs-contrib-hls/dist/videojs-contrib-hls.min.js', |
||
| 100 | 'node_modules/videojs-qualityselector/dist/videojs-qualityselector.js', |
||
| 101 | ], |
||
| 102 | dest: 'web/assets/dist/js/vendors.min.js' |
||
| 103 | } |
||
| 104 | }, |
||
| 105 | watch: { |
||
| 106 | css: { |
||
| 107 | files: ['web/assets/css/*.css'], |
||
| 108 | tasks: ['cssmin'] |
||
| 109 | }, |
||
| 110 | js: { |
||
| 111 | files: ['web/assets/js/*.js'], |
||
| 112 | tasks: ['uglify:app'] |
||
| 113 | }, |
||
| 114 | image: { |
||
| 115 | files: ['web/assets/image/*'], |
||
| 116 | tasks: ['copy'] |
||
| 117 | }, |
||
| 118 | }, |
||
| 119 | |||
| 120 | }); |
||
| 121 | grunt.registerTask('default', ["copy", "cssmin", "concat", "uglify"]); |
||
| 122 | }; |